$(document).ready(function(){
    $('.ml-column').sortable({
        connectWith: '.ml-column',
        placeholder: 'ml-column-highlight',
        handle: '.ml-widget-move'
    });
    $('.ml-column').disableSelection();
});

function loadContent(id, url){
    $(document).ready(function(){
        var objectContent = $('#'+id).children('div.ml-widget-content');
        objectContent.hide('fast', function(){
            objectContent.load(url,'',function(){
                objectContent.slideDown();
            });
        });
        var objectToggle = $('#'+id).children('div.ml-widget-head').children('div.ml-widget-toggle');
        objectToggle.click(function(){
            objectContent.slideToggle();
        });
        var objectRefresh = $('#'+id).children('div.ml-widget-head').children('div.ml-widget-refresh');
        objectRefresh.click(function(){
            objectContent.hide('fast', function(){
                objectContent.load(url,'',function(){
                    objectContent.slideDown();
                });
            });
        });
        
        var objectHead = $('#'+id).children('div.ml-widget-head');
        
        $('#'+id).hover(function(){
            objectHead.has('div.ml-widget-move').children('div.ml-widget-title').css('margin-left','10px');
            objectHead.children('div.ml-widget-toggle,div.ml-widget-refresh,div.ml-widget-move').show();
        }, function(){
            objectHead.has('div.ml-widget-move').children('div.ml-widget-title').css('margin-left','28px');
            objectHead.children('div.ml-widget-toggle,div.ml-widget-refresh,div.ml-widget-move').hide();
        });
    });
}